package com.qianbei.user;

import android.content.Context;
import android.view.View;

import com.qianbei.R;
import com.qianbei.common.adapter.CommonAdapter;
import com.qianbei.common.adapter.ViewHolder;

import java.util.List;

/**
 * 个人中心九宫格适配器
 *
 * @author jiaowenzheng
 *
 * Created by user on 16/9/4.
 */
public class LineGridViewAdapter extends CommonAdapter<UserCenterTableModel> {

    public LineGridViewAdapter(Context context, List<UserCenterTableModel> data, int itemLayoutId) {
        super(context, data, itemLayoutId);
    }

    @Override
    public void convert(ViewHolder helper, UserCenterTableModel item, int position) {

        helper.setText(R.id.tv_title,item.getTitle());
        helper.setBackgroundResource(R.id.iv_icon,item.getResId());

        if (item.getTip() <= 0){
            helper.setVisibility(R.id.tv_tip, View.GONE);
        }else{
            helper.setVisibility(R.id.tv_tip,View.VISIBLE);
            helper.setText(R.id.tv_tip,String.valueOf(item.getTip()));
        }

    }
}
